import type { VNode } from 'vue'

export interface SelectOption {
  label: string
  value: string
  disabled?: boolean
}

export interface SelectProps {
  modelValue: string
  options?: SelectOption[]
  placeholder?: string
  disabled?: boolean
  clearable?: boolean
  filterable?: boolean
  remote?: boolean
  renderLabel?: RenderLabelFun
  filterMethod?: CustomFilterFun
  remoteMethod?: CustomFilterRemoteFun
}

export interface SelectedStates {
  inputValue: string
  selectOption: null | SelectOption
  mouseHover: boolean
  loading: boolean
  highlightIndex: number
}

export interface RenderLabelFun {
  (option: SelectOption): VNode
}

export interface CustomFilterFun {
  // (value: string): SelectOption[]
  (value: string): Array<SelectOption>
}

export interface CustomFilterRemoteFun {
  (value: string): Array<SelectOption>
}

export interface SelectEmits {
  (e: 'update:modelValue', value: string): void
  (e: 'change', value: string): void
  (e: 'visible-change', value: boolean): void
  (e: 'clear'): void
}
